package com.starblink.brand.adapter

import com.starblink.android.basic.adapter.BaseBindingVH
import com.starblink.android.basic.ext.visibleOrGone
import com.starblink.basic.util.ActivityStackManage
import com.starblink.brand.bean.BrandLeftBean
import com.starblink.brand.databinding.CellBrandLeftBinding
import com.starblink.brand.ui.DiscountedI

class BrandLeftCell (binding: CellBrandLeftBinding ,
                     private val discountedI:DiscountedI) :
    BaseBindingVH<BrandLeftBean, CellBrandLeftBinding>(binding) {

    override fun onBind(model: BrandLeftBean, position: Int) {
        val merchantWebVOF = model.topBrandInfoVOF
        merchantWebVOF?.let {
            binding.ivBrandLogo.load(it.logo, it.name)
            binding.ivBrandLogoBig.load(it.logo, it.name)
            binding.tvBrandName.text=it.name
        }
        binding.ivBrandLogo.visibleOrGone(!model.selected)
        binding.cvBrandItem.visibleOrGone(model.selected)
        binding.tvBrandName.visibleOrGone(!model.selected)
        binding.llContentItem.setOnClickListener{
            discountedI.scrollToBrand(position)
        }
    }
}